<template>
  <div>
    <el-row>
      <el-col :span="24"><span>添加</span></el-col>
    </el-row>
    <el-row class="pa-m3u8-video">
      <el-col :span="8" v-for="video in videoList" :key="video.id">
        <card>
          <template v-slot:header>
            <div class="pa-m3u8-video-pic"></div>
          </template>
          <template v-slot:body>
            <div @click="routerPush(video.id)">{{ video.videoName }}</div>
            <div>{{ video.size }}MB</div>
            <div>{{ video.type }}</div>
          </template>
          <template v-slot:footer>
            <div><span>编辑</span><span>删除</span></div>
          </template>
        </card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Card from "@/components/card/Card.vue";

export default {
  name: "M3u8Video",
  components: {
    card: Card,
  },
  data() {
    return {
      videoList: [],
    };
  },
  created() {
    this.$http({
      url: "/m3u8video/list",
    }).then(({data}) => {
      this.videoList = data.list;
    });
  },
  methods: {
    routerPush(videoId) {
      this.$router.push({path: `/m3u8video/player/${videoId}`})
    }
  }
};
</script>

<style lang="scss">
.pa-m3u8-video {
  .pa-m3u8-video-pic {
    height: 300px;
  }
  .pa-m3u8-video-operator {
    display: flex;
  }
}
</style>